<?php
class Core_Common_Controllers_Plugins_Actionsetup extends Zend_Controller_Plugin_Abstract {
	
	public function dispatchLoopStartup($request) {
		
		//check if the request come frome ajax 
		if(!$request->isXmlHttpRequest()) {
			$front = Zend_Controller_Front::getInstance();
			if(!$front->hasPlugin('Zend_Controller_Plugin_ActionStack')) {
				$actionStack = new Zend_Controller_Plugin_ActionStack();
				$front->registerPlugin($actionStack,97);
			}
			else {
				$actionStack = $front->getPlugin('ZendControllerPlugin_ActionStack');
			}
			
			$menuAction = clone($request);
			$menuAction->setActionName("index")
						->setControllerName("menu")
						->setModuleName("default");
			$actionStack->pushStack($menuAction);
		}
	}
	
}
?>